<?php

namespace App\Http\Controllers\Example;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Jobs\SendReminderEmail;
use Carbon\Carbon;

class JobController extends Controller 
{
    /*
    **  config/queue.php中设置选择的连接方式
    *   config/database.php中设置数据库连接
    *   或者.env文件中配置也行
     */
    public function sendemail(){
        $data['email']="511652942@qq.com";
        $data['title']="test";
        $data['content']="队列任务";
       
        
        
        //onQueue 指定队列
        //onConnection 指定连接不填则默认连接
        ////延迟10分钟执行 
        $job = (new SendReminderEmail($data))->onQueue('sendemail')->onConnection('sync');
                    //->delay(Carbon::now()->addMinutes(1));

        dispatch($job);

    }

}
